package com.service.Impl;

import com.dao.UserDao;
import com.entity.User;
import com.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    /**
     * 用户登录业务
     *
     * @param user
     * @return
     */
    public User userLogin(User user) {
        User result = userDao.userLogin(user);
        if(result != null){
            return result;
        }
        return null;
    }

    /**
     * 通过id查询用户信息
     *
     * @param id
     * @return
     */
    public User userFindUser(int id) {
        return userDao.userFindUser(id);
    }

    /**
     * 模糊查询用户信息
     *
     * @param user
     * @return
     */
    public List<User> userFindUserVague(User user) {
        return userDao.userFindUserVague(user);
    }

    /**
     * 修改用户基础信息
     *
     * @param user
     * @return
     */
    public void userEdit(User user) {
        userDao.userEdit(user);
    }

    /**
     * 修改用户密码
     *
     * @param id
     * @param password
     * @return
     */
    public void userPwd(int id, String password) {
        userDao.userPwd(id, password);
    }

    /**
     * 提交解封申请
     * @param user
     */
    public void userApplyStatus(User user) { userDao.userApplyStatus(user); }

    /**
     * 上传头像
     * @param user
     */
    public void uploadImage(User user) { userDao.uploadImage(user); }

}
